Paintbrush notes:Resize on the fly:
Call this method from paint:
public void resizeApplet()
{
//ths desired width is the width of the applet minus the toolpanel - a bit more for the border
int widthDesired=getSize().width-toolPanel.getSize().width-10;
int heightDesired=getSize().height-colorPanel.getSize().height-10;
drawingPanel.setPreferredSize(new Dimension(widthDesired,heightDesired));
Container screen= getContentPane();
screen.removeAll();
screen.add(toolPanel);
screen.add(drawingPanel);
screen.add(colorPanel);
validate();
}
|